package com.wan.adapter

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import com.wan.R
import com.wan.entity.HomeArtItemEntity
import com.wan.uitls.FlowItemClickListener
import com.zhy.view.flowlayout.FlowLayout
import com.zhy.view.flowlayout.TagAdapter

class NavigationFlowAdapter(var context: Context, var datas: ArrayList<HomeArtItemEntity>?, var listener: FlowItemClickListener) : TagAdapter<HomeArtItemEntity>(datas) {

    private val mThreadName = this.javaClass.name

    override fun getView(parent: FlowLayout?, position: Int, t: HomeArtItemEntity?): View {

        var rootView = LayoutInflater.from(context).inflate(R.layout.navigation_flow_item_layout, parent, false)
        var textView = rootView.findViewById<TextView>(R.id.navigation_flow_item_tv)
        textView.text = datas!![position].title
        return rootView
    }

    override fun onSelected(position: Int, view: View?) {
        view!!.setOnClickListener {
            listener.onFlowItemClickListener(position)

        }
    }
}